$(function () {
    var fromTo = '';
    let fileName = ''
    $("#get_file_data").change(function () {
        let reader = new FileReader();
        let file = this.files[0];
        let workbook;
        fileName = file.name;
        reader.readAsBinaryString(file);
        reader.onload = function (e) {
            let data = e.target.result;
            workbook = XLSX.read(data, { type: 'binary' });
            let persons =[];
            // 遍历每张表读取
            for (let sheet in workbook.Sheets) {
                if (workbook.Sheets.hasOwnProperty(sheet)) {
                    fromTo = workbook.Sheets[sheet]['!ref'];//读取的全部数据 A1:AN203
                    console.log(fromTo);
                    persons = persons.concat(XLSX.utils.sheet_to_json(workbook.Sheets[sheet], { header: 1, defval: '' }));//合并数据
                    //break; // 如果只取第一张表，就取消注释这行
                }
            }
            console.log(persons);
            let notifyOptions = {
                /* 弹窗提醒，需要在配置文件中申请notifications权限
                type:basic image progress list
                */
                type:'basic',
                title:'这是一个标题',
                iconUrl:'../images/16.png',
                message:persons
            }
            chrome.notifications.create('notifyId',notifyOptions)
        }
    })
})